// Hand.cpp: implementation of the CHand class.
//
//////////////////////////////////////////////////////////////////////

#include "iface.h"
#include "Hand.h"

#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif

//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
const char* CHand::SlotName()
{
	return "Hand";
}

CHand::CHand() 
{

}

CHand::~CHand()
{

}

bool CHand::CheckPushPrecondition(const CCard &_card)
{
	return true;
}

#define SPACE_OPEN 14

void CHand::CalculateDrawingArea( int& _x, int&  _y, int& _width, int& _height )
{
	// max 13 open 

	_width = CARD_WIDTH;
	_height = 13 * SPACE_OPEN + CARD_HEIGHT;
	
}

void CHand::Draw(unsigned int _x, unsigned int _y, bool selected )
{
	ClearDrawingArea(_x, _y);
	
	if( cards_stored )
	{

		for( unsigned char i = 0; i < cards_stored; i++ )
		{
			cardstack[ i ].Draw( _x, _y + ( i * SPACE_OPEN ) );
		}
	}
	else
	{
		CCard::DrawPlaceHolder( _x, _y );
	}
}

bool CHand::IncreaseSelection()
{
	if( cards_stored && cards_selected < cards_stored )
	{
		cards_selected++;
		return true;
	}

	return false;
}
